package com.osremake.server;

import com.osremake.server.net.ServerPipeline;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import java.util.logging.Logger;

/**
 * @author kyle
 */
public class Server {
    private static final ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
    private static final Logger logger = Logger.getLogger(Server.class.getName());

    public static void main(String[] args) {
        logger.info("Launching...");
        bootstrap.setPipelineFactory(new ServerPipeline());
        bootstrap.bind(new InetSocketAddress(Integer.parseInt(args[0])));
        logger.info("Ready on port " + args[0]);
    }
}
